package ReflectionPractice;

import java.text.MessageFormat;

/**
 * @author d11yu
 */
public class Practice {
    public static void main(String[] args) {
        System.out.println("=====================");
        printClassInfo("".getClass());
        System.out.println("=====================");
        printClassInfo(Runnable.class);
        System.out.println("=====================");
        printClassInfo(java.time.Month.class);
        System.out.println("=====================");
        printClassInfo(String[].class);
        System.out.println("=====================");
        printClassInfo(int.class);
    }

    public static void printClassInfo(Class clz) {
        // name
        System.out.println(MessageFormat.format("Name: {0}", clz.getName()));
        // simple name
        System.out.println(MessageFormat.format("Simple name: {0}", clz.getSimpleName()));
        // package name
        System.out.println(MessageFormat.format("Package name: {0}", clz.getPackageName()));
        // is interface
        System.out.println(MessageFormat.format("Is interface: {0}", clz.isInterface()));
        // is enum
        System.out.println(MessageFormat.format("Is enum: {0}", clz.isEnum()));
        // is array
        System.out.println(MessageFormat.format("Is array: {0}", clz.isArray()));
        // is primitive
        System.out.println(MessageFormat.format("Is primitive: {0}", clz.isPrimitive()));
    }
}
